package com.lemon.smartsafetynew.net.services;

import android.content.Context;

import com.lemon.android.http.LemonRequestParams;
import com.lemon.smartsafety.app.IApplication;
import com.lemon.smartsafety.http.UrlInfo;
import com.lemon.smartsafety.http.callback.HandlerCallback;
import com.lemon.smartsafety.http.service.BaseHttpServices;
import com.lemon.smartsafetynew.entity.me.MeCompanyVo;
import com.lemon.smartsafetynew.util.constants.KeyConstants;
import com.zhy.http.okhttp.OkHttpUtils;

import java.util.List;

/**
 * Created by Andrew on 2017/8/30.
 */

public class MeServices extends BaseHttpServices {

    public static final String TAG = "MeServices";

    public MeServices(Context context) {
        super(context);
    }

    /**
     * 初始化，等同使用构造函数
     *
     * @return
     */
    public static MeServices init() {
        return new MeServices(IApplication.context());
    }


    /**
     * 初始化，等同使用构造函数
     *
     * @param context
     * @return
     */
    public static MeServices init(Context context) {
        return new MeServices(context);
    }



    /**
     * 获取企业
     *
     */
    public void getCompanyList(LemonRequestParams params) {

        HandlerCallback<List<MeCompanyVo>> callback = new HandlerCallback<List<MeCompanyVo>>(KeyConstants.URL_GET_COMPANY_LIST) {
        };
        String serverUrl = mSharedPreferencesServer.getRequestUrl(UrlInfo.GET_COMPANY_LIST);
        OkHttpUtils.post()
                .tag(callback.getTag())
                .url(serverUrl)
                .params(params)
                .build().execute(callback);

    }

}
